<?php

namespace App\Http\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Paper extends Model
{
    protected $table        = 'paper';
    protected $primaryKey   = 'paper_id';
    protected $fillable     =  ['course_id','paper_name','paper_score'];
    use SoftDeletes;
    protected $dates = ['deleted_at'];
    //关联试题表
    public function question(){
        return $this->hasMany('App\Http\Models\Question','paper_id','paper_id');
    }

    //关联学生得分表
    public function answerpaper(){
        //同一学生  试卷和 考的分数是一一对应的关系
        return $this->hasOne('App\Http\Models\AnswerPaper','paper_id','paper_id');
    }
}
